define(['jquery'],function($){
	function Widget(){
		//this.handlers={};
		this.boundingBox=null;
	};
	Widget.prototype={
		on:function(type,handle){
			if(typeof this.handlers[type] === "undefined"){
				this.handlers[type]=[];
			}
			if(typeof handle==="function" && Object.prototype.toString.call(handle)==='[object Function]'){
				this.handlers[type].push(handle);
			}
			return this;
			
		},
		fire:function(type,data){
			if(typeof this.handlers[type] !== "undefined"){
				for(var i=0,len=this.handlers[type].length;i<len;i++){
					var handle=this.handlers[type][i];
					if(typeof handle==='function' && Object.prototype.toString.call(handle)==='[object Function]'){
						handle(data);
					}
				}
			}

		},
		renderUI:function(){},//接口：添加dom节点
		bindUI:function(){},//接口：监听事件
		syncUI:function(){},//接口：初始化组件属性
		render:function(container){
			this.renderUI();
			this.handlers={};
			$(container || document.body).append(this.boundingBox);
			this.bindUI();
			this.syncUI();
		},
		destructor:function(){},
		destory:function(){
			this.destructor();
			this.boundingBox.off();
			this.boundingBox.remove();
		}

	};
	return {
		Widget:Widget
	}
});